package com.xq.vo;

/**
 * 数据库操作异常的枚举类
 */
public enum DataBaseEnum {

    // ------------------------- 数据库相关错误 -------------------------
    DUPLICATE_KEY(1001, "数据重复冲突"),
    DATA_NOT_FOUND(1002, "数据不存在"),
    OPTIMISTIC_LOCK(1003, "数据已被修改，请刷新后重试"),
    DATABASE_TIMEOUT(1004, "数据库操作超时"),
    INSERTION_FAILED(1005, "插入数据失败"),
    UPDATE_FAILED(1006, "更新数据失败"),
    DELETE_FAILED(1007, "删除数据失败"),
    QUERY_FAILED(1008, "查询数据失败")
    ;

    private final Integer code;

    private final String message;

    DataBaseEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
